<script type="text/javascript" src="jscript/Spinner.js"></script>
<link rel="stylesheet" type="text/css" href="css/Spinner.css" />
<script>
APP.point = {
	action:'proc/client/dashboard.php'
};

function point_showTreshold(id){
	FBModal_show2( APP.point.action, 'post', "proc=nilai-threshold&detachievID="+id, true, true, null);
}
</script>
<?php include_once('model/perbuatan.php') ?>
<?php include_once('model/detil_perbuatan.php') ?>
<h2>Point Kegiatan</h2>
<hr />
<table width="100%" cellpadding="5" cellspacing="0">
<tr class="header">
	<th align="left"><span class="colorWhite">Jenis</span></th>
	<th align="left"><span class="colorWhite">Bidang</span></th>
    <th align="left"><span class="colorWhite">Tingkat</span></th>
    <th align="left"><span class="colorWhite">Kategori</span></th>
    <th align="right"><span class="colorWhite">Jumlah</span></th>
</tr>
<?php $karyID = $_COOKIE_DATA->username;?>
<?php $res = "SELECT a.PERB_NO, b.DEPERB_NO, a.PERB_TGL, a.PERB_WAKTU, f.NIK, f.LAPOR_NAMA, b.DEPERB_TGL, 
					b.DEPERB_WAKTU, a.KODE_KARYAWAN, c.NAMA_KARYAWAN, d.ACHIEV_BIDANG, d.ACHIEV_JENIS,
					e.DETACHIEV_TINGKAT, e.DETACHIEV_ID, e.DETACHIEV_NAMA, b.DEPERB_STATUS, a.PERB_PRIVILEGES 
				FROM perbuatan as a, detil_perbuatan as b, data_karyawan as c, prestasipelanggaran as d,
					detil_prestasi_pelanggaran as e, pelapor as f 
				WHERE a.PERB_NO = b.PERB_NO 
					AND a.KODE_KARYAWAN = c.KODE_KARYAWAN 
					AND a.LAPOR_ID = f.LAPOR_ID 
					AND b.DETACHIEV_ID = e.DETACHIEV_ID 
					AND d.ACHIEV_ID = e.ACHIEV_ID 
					AND a.KODE_KARYAWAN='$karyID' 
				GROUP BY b.DETACHIEV_ID"; 
		$res = mysql_query($res);
?>
<?php while ($row = mysql_fetch_assoc($res) ):?>
<?php $pcount = deperb_countKegiatan($karyID, $row['DETACHIEV_ID'])?>
<?php $nilai = "SELECT * 
				FROM NILAI 
				WHERE DETACHIEV_ID='".$row['DETACHIEV_ID']."' AND $pcount BETWEEN NILAI_MIN AND NILAI_MAX";
	  $nilai = mysql_fetch_assoc( mysql_query($nilai) );
	  $tag_zebra = "";
	  if ($nilai['NILAI_MAX'] == $pcount) $tag_zebra = "bgcolor=\"#F9E3E3\"";
	  else $tag_zebra = tag_zebra($z++)
?>
<tr <?php echo $tag_zebra?> onClick="point_showTreshold('<?php echo $nilai['DETACHIEV_ID']?>')" class="fake clickable">
	<td><?php echo $row['ACHIEV_JENIS']?></td>
    <td><?php echo $row['ACHIEV_BIDANG']?></td>
    <td><?php echo $row['DETACHIEV_TINGKAT']?></td>
    <td><?php echo $row['DETACHIEV_NAMA']?> </td>
    <td align="right"><?php echo $pcount ?></td>
</tr>
<?php endwhile;?>
</table>